<?php 
require_once "Model.php";
require_once "Common/connDB.php";
	class musicModel extends Model{
		public function __construct(){
			parent::__construct();
		}
		public function getmusictype(){
		
			$sql="select * from musictype";
			$data=$this->conn->query($sql);
			return $data;
		}
		
		public function getmusics1(){
		
			$sql="select * from musics where tid=(select tid from musictype where typename='电影') limit 6";
			$data= $this->conn->query($sql);
			return $data;
			
		}
		public function getmusics2(){		
			$sql="select * from musics where tid=(select tid from musictype where typename='电视剧') limit 6";
			$data= $this->conn->query($sql);
			return $data;	
		}
		public function getmusics3(){		
			$sql="select * from musics where tid=(select tid from musictype where typename='动画片') limit 6";
			$data= $this->conn->query($sql);
			return $data;	
		}
		public function getmusics4(){		
			$sql="select * from musics where tid=(select tid from musictype where typename='爱情片') limit 6";
			$data= $this->conn->query($sql);
			return $data;	
		}
		public function getmusics5(){		
			$sql="select * from musics where tid=(select tid from musictype where typename='悬疑片') limit 6";
			$data= $this->conn->query($sql);
			return $data;	
		}
		public function getTopHit(){
			$sql="select * from musics   order by hittimes desc   limit 4";
			$data = $this->conn->query($sql);
			return $data;
		}
		public function getTopDown2(){			
			$sql="select * from musics   order by downtimes desc   limit 4";	
			$data = $this->conn->query($sql);
			return $data;
		}

		public function getTopDown(){			
			$sql="select * from musics   order by downtimes desc   limit 4";	
			$data = $this->conn->query($sql);
			return $data;
		}
		
		function getmusictypename(){

      $tid = $_GET['tid'];
      $sql0="select * from musictype where tid=$tid";
      $result0 = mysql_query($sql0) or die('查询失败！'.mysql_error());
      $row0 = mysql_fetch_assoc($result0);
      $sql = "select * from musics where tid={$tid}";
      $data7=$this->conn->query($sql);
      return $data7;

     }
		public function getTypemusic(){
			$tid = $_GET['tid'];
			$sql = "select * from musics where tid={$tid}";
			$data = $this->conn->query($sql);
			return $data;
		}

		public function getmusicContentbyID(){
            $mid=$_GET['mid'];
            $sql="select * from musics where mid=$mid";
            $data=$this->conn->query($sql);
            return $data;
    } 

        public function getmusictype2(){
            $sql3="select * from musictype";
            $data=$this->conn->query($sql3);
            return $data;
     }

		
	}

 ?>